package com.zksk.admin.domain.customer.vo;

import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.zksk.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author xiebo
 * @version 1.0
 * @description:
 * @date 2022/12/2 11:01
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel(value = "CustomerVo", description = "客户Vo")
public class CustomerVo extends BaseEntity {

    @ApiModelProperty("客户表主键")
    @JsonSerialize(using= ToStringSerializer.class)
    @NotNull(message = "ID不能为空!",groups = Update.class)
    private Long customerId;

    @ApiModelProperty(value = "客户（平台）名称",required = true)
    @NotNull(message = "客户名称不能为空!",groups = Insert.class)
    private String customerName;

    @ApiModelProperty(value = "客户（平台）编码,采用所选区域的编码 `areaCode`",required = true)
    @NotNull(message = "客户编码不能为空!",groups = Insert.class)
    private String customerCode;

    @ApiModelProperty(value = "区域编码",required = true)
    @NotNull(message = "请选择区域!",groups = Insert.class)
    private Long area_code;

    @ApiModelProperty(value = "区域名称（组合名称）",required = true)
    @NotNull(message = "请选择区域!",groups = Insert.class)
    private String merger_name;

    @NotNull(message = "请选择客户类型!",groups = Insert.class)
    @ApiModelProperty(value = "客户类型",required = true)
    private String customerType;

    @NotNull(message = "联系人不能为空!",groups = Insert.class)
    @ApiModelProperty(value = "联系人",required = true)
    private String contacts;

    @NotNull(message = "联系方式不能为空!",groups = Insert.class)
    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    @ApiModelProperty(value = "联系人联系方式",required = true)
    private String contactsPhone;

    @ApiModelProperty(value = "是否对接（0对接 1未对接）",required = true)
    private Integer handover;

    @ApiModelProperty("客户状态（0上线 1未上线）")
    private Integer status;

    @ApiModelProperty("0存在 2删除")
    @TableLogic
    private Integer delFlag;

    //**********************************************************************

    @ApiModelProperty(value = "产品需求绑定集合", required = true)
    @NotNull(message = "请选择客户类型!",groups = {Insert.class, Update.class})
    private List<Long> bindIds = new ArrayList();

    @ApiModelProperty("产品需求数据集合")
    private Page<CustomerProdReqVo> pageList;



    public static final String CUSTOMER_ID = "customer_id";

    public static final String CUSTOMER_NAME = "customer_name";

    public static final String CUSTOMER_CODE = "customer_code";

    public static final String REGION_ID = "area_code";

    public static final String REGION_NAME = "region_name";

    public static final String CUSTOMER_TYPE = "merger_name";

    public static final String CONTACTS = "contacts";

    public static final String CONTACTS_PHONE = "contacts_phone";

    public static final String HANDOVER = "handover";

    public static final String STATUS = "status";

    public static final String CREATE_BY = "create_by";

    public static final String UPDATE_BY = "update_by";

    @Override
    public Serializable pkVal() {
        return this.customerId;
    }

}

